var core        = require("core")
,   mongoose    = require("mongoose")
,   db          = core.db
,   dbPlugin    = db.plugin
,   utils       = core.utils
,   Schema      = mongoose.Schema
,   name        = "Platform";

var Platform = function(){

    var options = {
        pid         : { type: Number, index: true },
        platformId  : { type: String, index: true },
        key         : { type: String },
        secret      : { type: String },
        url         : { type: String },
        msg         : { type: String },
        admin       : { type: String },
        number      : { type: String },
        time        : { type: Number, default: Date.now },
        expires     : { type: Number, default: 1000 * 60 * 180 }
    };

    var Platform = new Schema(options);

    Platform.plugin(dbPlugin.increment, {
        model       : name,
        field       : "pid",
        start       : 0,
        increasing  : 1
    });

    return Platform;

};

module.exports = Platform;
